# -*- utf-8 -*-

import urllib.parse
from pathlib import Path
import re
import os

dir = "C:\\bing2\\人物"
path = Path(dir)


for file in path.iterdir():
    name = str(file).split('\\')[-1]
    name = urllib.parse.unquote(name)
    name = urllib.parse.unquote(name)
    name = re.sub(r'[|\\/><:?"*]','',name)
    newfile = path/name
    try:
        file.rename(newfile)
    except:
        print(str(file))
        os.remove(str(file))
    






